import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import pinia from './store'
import directives from './directives'

// 导入TDesign样式
import 'tdesign-vue-next/es/style/index.css'

// 导入全局样式
import './assets/styles/index.scss'

// 导入TDesign图标
import * as TDesignIcons from 'tdesign-icons-vue-next'

// 开发环境下导入mock服务
if (import.meta.env.DEV) {
  import('./mock')
}

// 创建应用实例
const app = createApp(App)

// 注册所有TDesign图标为全局组件
Object.keys(TDesignIcons).forEach(key => {
  app.component(key, TDesignIcons[key])
})

// 注册全局指令
app.use(directives)

// 注册状态管理
app.use(pinia)

// 注册路由
app.use(router)

// 挂载应用
app.mount('#app')
